/*
    23. Write a program in C to check whether a character is Hexadecimal Digit or not. 

    Test Data :
    Input a character : 7

    Expected Output :

    The entered character is a hexadecimal digit.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define MAX_LEN 1024
#define MAX_STR 256

char* getstr(char *str)
{
    char ch;
    char *p = str;
    while((ch = getchar()) != '\n'){
        *p++ = ch;
    }
    *p = '\0';
    return str;
}

int ishex(char ch)
{
    if((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')){
        return 1;
    }
    return 0;
}

int main(void)
{
    char ch;
    printf("Input a character : ");
    scanf("%c", &ch);
    if(ishex(ch)){
        printf("The entered character is a hexadecimal digit.");
    }else{
        printf("The entered character is not a hexadecimal digit.");
    }

    return 0;
}